package com.atguigu.mapreduce.demo.comparable;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @version V1.0
 * @author: guangcheng
 * @date: 2021/11/18 19:33
 * @description: K V 根据情形而定, 并不是固定的
 */
public class PCounterReduce extends Reducer<FlowBean, Text, Text, FlowBean> {


    @Override
    protected void reduce(FlowBean key, Iterable<Text> values, Context context) throws IOException, InterruptedException {

        /**
         * 相同sumFlow进入一个集合,
         * 但是sumFlow只是依据, 不会进入集合, 进入集合的是Value
         *
         */
        for (Text value : values) {
            context.write(value, key);
        }
    }
}

